<template>
  <div class="application-item-box" :class="{ firstList: indexMark == 0 }">
    <div class="item-box-contant typeCloud" v-if="itemType == 'cloud'">
      <div class="box-left" @click="gotoDetails(itemData.id)">
        <van-image width="84" height="82" radius="14" :src="itemData.icon" />
      </div>

      <div class="box-center" @click="gotoDetails(itemData.id)">
        <div>
          <div class="box-center-top">
            {{ itemData.name?.length > 16 ? itemData.name?.slice(0, 16) + '...' : itemData.name }}
          </div>
          <div
            class="box-center-bottom"
            :style="{
              color: textColor,
            }"
          >
            {{ itemData.slogan }}
          </div>
        </div>
        <div>
          <van-button
            type="primary"
            size="small"
            :color="buttonColo"
            class="down-btn"
            round
            @click="downGame(itemData)"
            >{{ $t('startgame') }}</van-button
          >
        </div>
      </div>
    </div>

    <!-- <div class="box-right">
      <van-button type="primary" size="small" :color="buttonColo" class="down-btn" round
        >获取</van-button
      >
    </div> -->
  </div>
</template>

<script setup>
import { RouterView, useRoute, useRouter } from 'vue-router'
const router = useRouter()
const props = defineProps({
  itemData: {
    type: Object,
    default: {
      pic: 'https://sysgamer.com/gameres/pic/banner1.jpg',
    }, //advertising  cloud
  },
  itemType: {
    type: String,
    default: 'advertising', //advertising  cloud
  },
  buttonColo: {
    type: String,
    default: '', //按钮颜色
  },

  textColor: {
    type: String,
    default: 'fff', //文本颜色高度
  },
  indexMark: {
    default: '', //文本颜色高度
  },
})

const gotoDetails = (id) => {
  console.log('gotoDetails')
  router.push({
    name: 'gameDetailsMoblie',
    query: {
      id,
    },
  })
}
const downGame = (item) => {
  window.location = item.play_url
}
</script>

<style lang="scss" scoped>
.application-item-box {
  .item-box-contant {
    display: flex;
    // align-items: center;
    width: 100%;
  }

  .box-left {
    width: 80px;
    display: flex;
    justify-content: center;
    margin-top: 6px;
    margin: 12px 0 8px 0;
  }

  .typeCloud {
    margin: 0px 0 10px 0;
  }
  .typeCloud .box-left {
    display: flex;
    justify-content: center;
    justify-content: flex-start;
    width: auto;
    margin-right: 12px;
  }

  .typeCloud .box-right {
    width: auto;
  }
  .box-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-top: 1px solid #c6c6c8;
    padding-top: 6px;

    .box-center-top {
      font-weight: bold;
      margin-top: 4px;
      margin-bottom: 6px;
      font-size: 15px;
    }
    .box-center-bottom {
      font-size: 13px;
    }
  }

  .box-right {
    width: 90px;
  }
  .down-btn {
    padding: 0px 16px !important;
    font-size: 14px;
    color: #0d7ffe !important;
    font-weight: bold;
  }
  .white-color {
    color: #fff;
  }
}

.firstList {
  .box-center {
    border-top: none !important;
  }
}
</style>
